package com.sino.onlinebank.controller;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.sino.base.basecontroller.BaseController;
import com.sino.common.Common;
import com.sino.onlinebank.service.OnlineBankService;

@Controller
@Scope("prototype")
@RequestMapping("/onlineBank/")
public class OnlineBankController extends BaseController {

	@Autowired
	private OnlineBankService onlineBankService;

	@RequestMapping("index")
	public String index() {
		return Common.BACKGROUND_PATH + "/onlinebank/country";
	}

	
	@RequestMapping("Province.html")
	public ModelAndView Province() {
		Date now = new Date(); 
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
		String date=dateFormat.format(now); 
		ModelAndView mv=new ModelAndView(Common.BACKGROUND_PATH + "/onlinebank/province");
		return mv;
	}
	
	/**
	 * 获取全国销量情况
	 * @return
	 */
	@RequestMapping("ChinaMap.html")	
	public @ResponseBody List<Map<String, Object>> getChinaMap() {
		List<Map<String, Object>> data=onlineBankService.getChinaMap();
		return data;
	}
	
	/**
	 * 查询全国销量top10
	 * @return
	 */
	@RequestMapping("ChinaTopTen.html")	
	public @ResponseBody List<Map<String, Object>> getChinaTopTen() {
		List<Map<String, Object>> data=onlineBankService.getChinaTopTen();
		return data;
	}
	
	/**
	 * 查询全国实时交易量
	 * @return
	 */
	@RequestMapping("ChinaRealTime.html")	
	public @ResponseBody List<Map<String, Object>> getChinaRealTime() {
		List<Map<String, Object>> data=onlineBankService.getChinaRealTime();
		return data;
	}
	
	/**
	 * 查询全国交易种类top10
	 * @return
	 */
	@RequestMapping("ChinaTypeTopTen.html")	
	public @ResponseBody List<Map<String, Object>> ChinaTypeTopTen() {
		List<Map<String, Object>> data=onlineBankService.ChinaTypeTopTen();
		return data;
	}
	
	/**
	 * 查询全国交易量
	 * @return
	 */
	@RequestMapping("ChinaSaleAmount.html")	
	public @ResponseBody List<Map<String, Object>> ChinaSaleAmount() {
		List<Map<String, Object>> data=onlineBankService.ChinaSaleAmount();
		return data;
	}
	
	
}
